|
|
|
|
|
|
|
In point processing, the value of an output pixel depends only on its own value. In area processing, the value of an output pixel depends on the values of several different pixels. |
|
|
|
|
|
|
|
|
Spatial filtering is one kind of area processing. In spatial filtering, a pixel's value depends on the pixels in a square region surrounding it. These other nearby pixels give information about the input pixel's neighborhood. They let the program examine such values as the area's overall brightness, the difference in the pixels' values, and the orientation of features in the area. |
|
|
|
|
|
|
|
|
Other forms of area processing are based on geometric transformations. Some simple geometric transformations include shrinking, stretching, and rotating an image. More complex transformations let you twist and distort an image in interesting ways. |
|
|
|
|
|
|
|
|
The most common form of area processing is spatial filtering. In spatial filtering, the program determines a pixel's output value by taking a specially weighted average of the values of the nearby pixels. |
|
|
|
|
|
|
|
|
The usual way to take this weighted average is to define an array of numbers, called the kernel, that defines the coefficients that should be applied to the pixels in the area. Usually, the kernel is square and has an odd number of rows and columns so that the pixel of interest can lie in the exact center. In Visual Basic, you can store the kernel values in an array that is symmetric around zero. For example, a three-by-three kernel might be dimensioned with the following code: |
|
|
|
 |
|
|
|
|
Dim kernel(-1 To 1) As Single |
|
|
|
|
|
|
|
|
In any array dimensioned symmetrically around zero, the coefficient corresponding to the center pixel is kernel (0, 0). |
|
|
|
|
|